//
//  JsThreadManager.m
//  JsUtilitySdk
//
//  Created by Gikki Ares on 2023/4/14.
//

#import "JsThreadManager.h"

@implementation JsThreadManager

+ (void)runInMainThreadAsync:(void(^)(void))handler {
	dispatch_async(dispatch_get_main_queue(), ^{
		handler();
	});
}


+ (void)runInMainThreadSync:(void(^)(void))handler {
	if([NSThread isMainThread]) {
		handler();
	}
	else {
		dispatch_sync(dispatch_get_main_queue(), ^{
			handler();
		});
	}
}

@end
